package webjoch.process.strategies.puzzles;

import java.awt.Graphics2D;

import com.rsbuddy.event.events.MessageEvent;
import com.rsbuddy.script.methods.Calculations;
import com.rsbuddy.script.task.Task;
import com.rsbuddy.script.wrappers.Npc;

import webjoch.process.strategies.Puzzle;
import webjoch.wrappers.Room;
/**
 * 
 * @author Webjoch
 *
 */
public class Ghosts extends Puzzle{
	Room room;
	
	public final int[] GHOST = {10983, 10985, 10987};
	
	@Override
	public void setRoom(Room room) {
		this.room = room;		
	}

	public Npc getGhost(){
		return room.getNpc(GHOST);
	}
	
	@Override
	public boolean isValid() {
		return getGhost() != null;
	}

	@Override
	public Type getType() {
		return Type.GHOSTS;
	}

	@Override
	public int loop() {
		Npc ghost = getGhost();
		if (!ghost.isInCombat()){
			if (Calculations.distanceTo(ghost) > 5)
				ghost.getLocation().clickOnMap();
			else ghost.interact("Attack");
			
			Task.sleep(500, 2000);
		}
		return 0;
	}

	@Override
	public int[] itemNeed() {
		return new int[0];
	}

	@Override
	public boolean isFinished() {
		return false;
	}

	@Override
	public void messageReceived(MessageEvent e) {
		
	}

	@Override
	public void onRepaint(Graphics2D g) {
		// TODO Auto-generated method stub
		
	}

}
